package com.appspot.moviesessions;

import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.widget.Button;
import android.widget.ListView;

public class MovieInfoActivity extends FragmentActivity implements
		MovieInfoView {

	private MovieInfoPresenter presenter;

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.movie_info);
		/*
		 * ((TextView) findViewById(R.id.movie_info_name)).setText(getIntent()
		 * .getDataString());
		 */
		AndroidFactory androidFactory = AndroidFactory.getInstance();
		this.presenter = new MovieInfoPresenter(this, new LoaderFactoryImpl(
				this, androidFactory, new ViewBinderFactoryImpl(
						getContentResolver(), androidFactory, androidFactory),
				androidFactory, androidFactory), androidFactory, androidFactory);

	}

	@Override
	protected void onStart() {
		// TODO Auto-generated method stub
		super.onStart();
		presenter.onStart();
	}

	@Override
	protected void onDestroy() {
		super.onDestroy();
		presenter.onDestroy();
		presenter = null;
	}

	@Override
	public ListView getMovieInfo() {
		return (ListView) findViewById(R.id.movie_info_list);
	}

	@Override
	public Context getContext() {
		return this;
	}

	@Override
	public Button getSessionsButton() {
		return (Button) findViewById(R.id.btnSession);
	}

}
